package de.pchsws.blackboarder;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AutoCompleteTextView;
import android.widget.Button;

/**
 * 
 * @author yannick
 * @version 1.0
 */
public class InputActivity extends Activity implements OnClickListener {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_input);
		setButtonClickListener();
	}

	private void setButtonClickListener() {
		Button button = (Button) findViewById(R.id.buttonSubmit);
		button.setOnClickListener(this);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_input, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		AutoCompleteTextView text = (AutoCompleteTextView) findViewById(R.id.inputField);
		String input = text.getText().toString();
		Intent intent = new Intent(this, DisplayActivity.class);
		intent.putExtra(DisplayActivity.TEXT_EXTRA, input);
		startActivity(intent);
	}
}
